# This is Py-GenshinImpact Launcher script
import winreg


pth = r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 730"
name = "InstallLocation"

def getlocate():
    try:
        # 打开注册表
        key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, pth)
        # 读取安装路径
        value, reg_type = winreg.QueryValueEx(key, name)
        #print("Key: ", value)
        winreg.CloseKey(key)
        return value
    except WindowsError as e:
        print("错误: ", e)
        return False
def getname():
    pth2 = r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 730"
    name2 = "DisplayName"
    try:
        # 打开注册表
        key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, pth2)
        # 读取安装路径
        val, reg_type = winreg.QueryValueEx(key, name2)
        #print("Key value: ", val)
        if 'Counter' in val:
            return val
        else:
            return False
        winreg.CloseKey(key)
    except WindowsError as e:
        print("错误: ", e)
        return False
def gets():
    return [getlocate(),getname()]
gets()